import exp from "constants"
import http, { RequestOption } from "./http"

export interface TreasuryCreateParam {
  treasuryName: string
  treasuryDescription: string
  treasuryLogo ?: string
}

export const createTreasury = (treasuryParam: TreasuryCreateParam, options ?: RequestOption) => {
  return http.post(
    {
      url: '/treasury/create',
      data: treasuryParam
    },
    options
  )
}

export const getTreasuryDetail = (treasuryId: number, options ?: RequestOption) => {
  return http.get(
    {
      url: '/treasury/detail',
      data: { treasuryId }
    },
    options
  )
}

export const getTreasuryTaskList = (treasuryId: number, options ?: RequestOption) => {
  return http.get(
    {
      url: '/task/list',
      data: { treasuryId }
    },
    options
  )
}

export const getTreasuryGoodsList = (treasuryId: number, options ?: RequestOption) => {
  return http.get(
    {
      url: '/treasury/goods/all',
      data: { treasuryId }
    },
    options
  )
}

export const getTreasuryPrizeList = (treasuryId: number, options ?: RequestOption) => {
  return http.get(
    {
      url: '/treasury/prize/all',
      data: { treasuryId }
    },
    options
  )
}

export const getTreasuryCheckinDetail = (treasuryId: number, options ?: RequestOption) => { 
  return http.get(
    {
      url: '/treasury/checkin/detail',
      data: { treasuryId }
    },
    options
  )
}

export const checkinTreasury = (treasuryId: number, options ?: RequestOption) => {
  return http.post(
    {
      url: '/treasury/checkin/submit',
      data: { treasuryId }
    },
    options
  )
}